package test;

import org.junit.Test;
import redis.clients.jedis.Jedis;

import java.util.Scanner;

public class BitCalculate {

    private static final int _64mb = 1 << 29;

    @Test
    public void bitCal() {

        System.out.println(1 << 29);
        System.out.println(1 << 3);
        System.out.println(rectify2MB(1 << 29) + "MB");
        System.out.println(rectify2MB(1 << 19) + "MB");

        System.out.println((_64mb - 1) & _64mb);

        System.out.println(Math.pow(16, 4));
    }

    public static int rectify2MB(Integer input) {
        return input >> 10 >> 10 >> 3;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        while (true) {
            if (input != 0) {
                int bitCal = input & input - 1;
                if (bitCal == 0){
                    int _2pow = 0;
                    while(input != Math.pow(2,_2pow)){
                        if ( input >= 2 ){
                            ++_2pow;
                        }else {
                            break;
                        }
                    }
                    System.out.println(input +" --- " + _2pow + " power");
                }
                input = scanner.nextInt();
            } else {
                break;
            }
        }
    }

    @Test
    public void bitTest(){
        Jedis jedis = new Jedis("172.28.40.190", 16379);
        Boolean test = jedis.setbit("test", 111, true);
        System.out.println(test);
    }
}
